package models

import "github.com/astaxie/beego/orm"

type UploadLogData struct {
	Id           int    `orm:"pk;auto"`
	CreateTime   string `orm:"size(32);null;index"`
	DeviceId     string `orm:"size(32);null;index"`
	StoreCode    string `orm:"size(64);null;index"`
	UploadLogUrl string `orm:"size(256);null"`
}

func (this *UploadLogData) TableEngine() string {
	return "INNODB"
}

//菜单对象重写表名称方法,此处可以自定义表名称
func (m *UploadLogData) TableName() string {
	return "upload_log_data"
}

func (this *UploadLogData) Insert() error {
	if _, err := orm.NewOrm().Insert(this); err != nil {
		return err
	}
	return nil
}

func (this *UploadLogData) Update(fields ...string) error {
	if _, err := orm.NewOrm().Update(this, fields...); err != nil {
		return err
	}
	return nil
}

func (this *UploadLogData) Read(fields ...string) error {
	if err := orm.NewOrm().Read(this, fields...); err != nil {
		return err
	}
	return nil
}

func (this *UploadLogData) Delete() error {
	if _, err := orm.NewOrm().Delete(this); err != nil {
		return err
	}
	return nil
}

func init() {
	orm.RegisterModel(new(UploadLogData))
}
